home *** CD-ROM | disk | FTP | other *** search
- function CreateXMLHttp()
- {
- var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
- if (!xmlhttp) alert("XMLHttpRequest object cannot be created.");
- return xmlhttp;
- }
-
- function NewXML(rootkey)
- {
- var xmlDoc;
- if (document.implementation && document.implementation.createDocument)
- {
- xmlDoc = document.implementation.createDocument("", rootkey, null);
- }
- else if (window.ActiveXObject)
- {
- xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- }
- else
- {
- return;
- }
- return xmlDoc;
- }
-
- function LoadXMLFile(xmlfile)
- {
- var xmlDoc;
- if (document.implementation && document.implementation.createDocument)
- {
- xmlDoc = document.implementation.createDocument("", "", null);
- //xmlDoc.onload = callback;
- }
- else if (window.ActiveXObject)
- {
- xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- xmlDoc.onreadystatechange = function () {
- //if (xmlDoc.readyState == 4) callback()
- };
- }
- else
- {
- return;
- }
- xmlDoc.async = false;
- try {
- if (!xmlDoc.load(xmlfile)) return null;
- }
- catch (ex)
- {
- return null;
- }
- return xmlDoc;
- }
-
- function AddPrefNode(doc, path, value)
- {
- var i;
- var tokens = path.split('.');
- var node = doc.firstChild;
- var newnode;
- for (i = 0; i < tokens.length; i++) {
- newnode = doc.createElement("node");
- newnode.setAttribute("key", tokens[i]);
- node = node.appendChild(newnode);
- }
- node.setAttribute("value", value);
- }
-
- function PostPrefXML(data)
- {
- var xmlhttp = CreateXMLHttp();
- xmlhttp.open("POST", "/pref/import", false);
- xmlhttp.send(data);
- if (xmlhttp.responseText != "OK")
- alert("Error posting preference data to MediaCoder.");
- delete xmlhttp;
- }
-
- function SendCommand(cmd)
- {
- var xmlhttp = CreateXMLHttp();
- xmlhttp.open("GET", "/ui?cmd=" + cmd, false);
- xmlhttp.send(null);
- delete xmlhttp;
- }
-
- function SetWindowSize(width, height)
- {
- window.innerWidth = width;
- window.innerHeight = height;
- }
-